<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html><head>
<title>hg.cdm_template</title>
<style>
body {
    background:white;
    margin: 0em 1em 10em 1em;
    color: black;
}

h1 { color: white; background: #4FA4FF; }
h2 { color: white; background: #4FA4FF; }
h3 { color: white; background: #00557F; }
h4 { color: white; background: #00557F; }
    
a { color: #AA5500; }

</style>
</head>
<body><a NAME="top" ID="top"></a>
<h1>hg.cdm_template</h1>

<h3>Global Attributes</h3>
<table>
<tr><td>Context</td></tr><tr><td>Template</td></tr><tr><td>template_cache</td></tr>
</table>
<h3>Classes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Functions</h3>
<table>
<tr>
<td><a href="#_swap_settings">_swap_settings</a></td>
<td>Swap in selected Django settings, returning old settings.</td>
</tr><tr>
<td><a href="#_urlnode_render_replacement">_urlnode_render_replacement</a></td>
<td>Replacement for django's {% url %} block.</td>
</tr><tr>
<td><a href="#create_template_register">create_template_register</a></td>
<td>Used to extend the Django template library with custom filters and tags.</td>
</tr><tr>
<td><a href="#load">load</a></td>
<td>Loads the Django template from the given path.</td>
</tr><tr>
<td><a href="#register_template_library">register_template_library</a></td>
<td>Registers a template extension module to make it usable in templates.</td>
</tr><tr>
<td><a href="#render">render</a></td>
<td>Renders the template at the given path with the given dict of values.</td>
</tr><tr>
<td><a href="#wrap_render">wrap_render</a></td>
<td></td>
</tr>
</table>
<hr /><hr />
<a NAME="_swap_settings" ID="_swap_settings"></a>
<h2>_swap_settings</h2>
<b>_swap_settings</b>(<i>new</i>)
<p>
Swap in selected Django settings, returning old settings.
</p><p>
  Example:
	save = _swap_settings({'X': 1, 'Y': 2})
	try:
	  ...new settings for X and Y are in effect here...
	finally:
	  _swap_settings(save)
</p><p>
  Args:
	new: A dict containing settings to change; the keys should
	  be setting names and the values settings values.
</p><p>
  Returns:
	Another dict structured the same was as the argument containing
	the original settings.  Original settings that were not set at all
	are returned as None, and will be restored as None by the
	'finally' clause in the example above.  This shouldn't matter; we
	can't delete settings that are given as None, since None is also a
	legitimate value for some settings.  Creating a separate flag value
	for 'unset' settings seems overkill as there is no known use case.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="_urlnode_render_replacement" ID="_urlnode_render_replacement"></a>
<h2>_urlnode_render_replacement</h2>
<b>_urlnode_render_replacement</b>(<i>self, context</i>)
<p>
Replacement for django's {% url %} block.
</p><p>
  This version uses WSGIApplication's url mapping to create urls.
</p><p>
  Examples:
</p><p>
  <a href="{% url MyPageHandler "overview" %}">
  {% url MyPageHandler implicit_args=False %}
  {% url MyPageHandler "calendar" %}
  {% url MyPageHandler "jsmith","calendar" %}
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="create_template_register" ID="create_template_register"></a>
<h2>create_template_register</h2>
<b>create_template_register</b>(<i></i>)
<p>
Used to extend the Django template library with custom filters and tags.
</p><p>
  To extend the template library with a custom filter module, create a Python
  module, and create a module-level variable named "register", and register
  all custom filters to it as described at
  http://www.djangoproject.com/documentation/templates_python/
	#extending-the-template-system:
</p><p>
	templatefilters.py
	==================
	register = webapp.template.create_template_register()
</p><p>
	def cut(value, arg):
	  return value.replace(arg, '')
	register.filter(cut)
</p><p>
  Then, register the custom template module with the register_template_library
  function below in your application module:
</p><p>
	myapp.py
	========
	webapp.template.register_template_library('templatefilters')
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="load" ID="load"></a>
<h2>load</h2>
<b>load</b>(<i>theme, template_file, debug=False</i>)
<p>
Loads the Django template from the given path.
</p><p>
  It is better to use this function than to construct a Template using the
  class below because Django requires you to load the template with a method
  if you want imports and extends to work in the template.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="register_template_library" ID="register_template_library"></a>
<h2>register_template_library</h2>
<b>register_template_library</b>(<i>package_name</i>)
<p>
Registers a template extension module to make it usable in templates.
</p><p>
  See the documentation for create_template_register for more information.
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="render" ID="render"></a>
<h2>render</h2>
<b>render</b>(<i>theme, template_file, template_dict, debug=False</i>)
<p>
Renders the template at the given path with the given dict of values.
</p><p>
  Example usage:
	render("templates/index.html", {"name": "Bret", "values": [1, 2, 3]})
</p><p>
  Args:
	template_path: path to a Django template
	template_dict: dictionary of values to apply to the template
</p>
<div align="right"><a href="#top">Up</a></div>
<hr /><hr />
<a NAME="wrap_render" ID="wrap_render"></a>
<h2>wrap_render</h2>
<b>wrap_render</b>(<i>context, orig_render=template.render</i>)

<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>